package com.future.servlet;

import com.future.biz.AreaBIZ;
import com.future.model.bo.AreaBO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class NextAreaServlet extends HttpServlet{
	
	private static Logger logger = LogManager.getLogger(NextAreaServlet.class);
	
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doPost(req, resp);
	}
	public void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String flag = req.getParameter("flag");
		String code = req.getParameter("code");
		String areano = code.substring(0,9);
		
		AreaBIZ areaBiz = new AreaBIZ();
		logger.debug(areano);
		AreaBO areaBo = null;
		if(flag!=null&&!("").equals(flag)&&("aa").equals(flag)){
			areaBo = areaBiz.generateLowerAreaBO(code,flag);
		}
		logger.debug(areaBo);
		req.setAttribute("areaBo", areaBo);
		req.getRequestDispatcher("/currentarea.jsp").forward(req, resp);
	}
}
